package com.qf.mpswaggershiro.product.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import com.qf.mpswaggershiro.product.entity.IndexImg;
import com.qf.mpswaggershiro.product.service.IIndexImgService;
import com.qf.mpswaggershiro.vo.Vo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController  //ioc扫描
@RequestMapping("/index")
@CrossOrigin  //跨域
public class ArouselController {

    @Autowired
    IIndexImgService imgService;


    /**
     * 首页轮播图
     * @return
     */
    @GetMapping("/indeximg")
    public Vo getArousel(){
        QueryWrapper<IndexImg> indexImgQueryWrapper = new QueryWrapper<>();
        indexImgQueryWrapper.eq("status",1);
        indexImgQueryWrapper.orderByAsc("seq"); //排序 正序
        List<IndexImg> list = imgService.list(indexImgQueryWrapper);

        return Vo.arousel(list,10000,"success");

    }


}
